home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 12338 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.1 KB

  1. Path: mail2news.demon.co.uk!genesis.demon.co.uk
  2. From: Lawrence Kirby <fred@genesis.demon.co.uk>
  3. Newsgroups: comp.os.vms,comp.sys.dec,comp.lang.c
  4. Subject: Re: getting correct local time in VAX C program
  5. Date: Sun, 31 Mar 96 13:19:21 GMT
  6. Organization: none
  7. Message-ID: <828278361snz@genesis.demon.co.uk>
  8. References: <4jec36$ff3@lastactionhero.rs.itd.umich.edu>
  9. Reply-To: fred@genesis.demon.co.uk
  10. X-NNTP-Posting-Host: genesis.demon.co.uk
  11. X-Newsreader: Demon Internet Simple News v1.27
  12. X-Mail2News-Path: genesis.demon.co.uk
  13.  
  14. In article <4jec36$ff3@lastactionhero.rs.itd.umich.edu>
  15.            raffel@umich.edu "David Raffel" writes:
  16.  
  17. >
  18. >I'm having a problem using the c localtime function to convert a
  19. >"timestamp" (represented in seconds since 1/1/1970) to a date
  20. >and time.  I'm running under VMS V5.5-2 and using VAXC V3.1.
  21. >
  22. >The problem is that the timestamp is being written out to a file
  23. >by a SUN which takes into account timezone information.  When I
  24. >read the timestamp on VMS and convert it, I get the correct date,
  25. >but the time is off by 5 hours.  I assume that this is because
  26. >the VAX doesn't use any timezone information and always returns
  27. >GMT.
  28.  
  29. Or perhaps the VAX represents a time_t value in terms of seconds since
  30. 1/1/1970 00:00:00 local time rather than GMT as Unix does (just a guess).
  31. The comp.lang.c answer is that you get no guarantees at all on the
  32. representation of a time_t value, except that it is an arithmetic type
  33. (it may not even be an integer).
  34.  
  35. How do you want to deal with timezones? If the VAX system was in a different
  36. timezone to the SUN system do you want to reserve the time numericl value
  37. or the correct time instant? If VMS supports timezone information you
  38. can use that to adjust to local time, if not then you would either have
  39. to write a local time value from the SUN or add an extra field supplying
  40. information about the timezone environment the SUN program was using (or just
  41. apply your own, preferably configuarble, fudge factor on the VAX).
  42.  
  43. -- 
  44. -----------------------------------------
  45. Lawrence Kirby | fred@genesis.demon.co.uk
  46. Wilts, England | 70734.126@compuserve.com
  47. -----------------------------------------
  48.